package com.wgchao.mdmp.common.aal;

import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @ClassName: XTYData
 * @author: wgchao
 * @createTime: 2019/11/4 3:57 PM
 * @Description: TODO
 */
@Data
public class XTYData implements ObjectData{


    private String xt;//血糖3

    public static XTYData getInitializtion(String dataStr){
        XTYData xty = new XTYData();
        xty.xt = dataStr.substring(dataStr.length()-3);
        BigDecimal sg = new BigDecimal(xty.xt);

        xty.xt = sg.divide(new BigDecimal(18), 1, RoundingMode.HALF_UP).toString();
        return xty;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("血糖仪：{\n");
        sb.append("	血糖:"+this.xt+"\n");
        sb.append("}\n");
        return sb.toString();
    }

    public static void main(String[] args) {
        BigDecimal sg = new BigDecimal(46);
        String bg = sg.divide(new BigDecimal(18), 1, RoundingMode.HALF_UP).toString();
        System.out.println(bg);
    }
}